
{ Open notepad and run this: }

procedure TForm1.Button1Click(Sender: TObject);
begin
  SetWindowText(FindWindow('notepad', nil), 'Hello!');
  SendMessage(FindWindow('notepad', nil), WM_SETTEXT, 0, Integer(PChar('Hello!')));
end;